using System;
using EnvDTE;
using NUnitGenAddIn.Core;

namespace NUnitGenAddIn.VS2005
{
    /// <summary>
    /// Visual Studio 2005 <see cref="NUnit"/> Generator Helper Abstract Factory
    /// </summary>
	public class VS2005NUnitGenHelperAbstractFactory : NUnitGenHelperAbstractFactory
	{
        /// <summary>
        /// Creates the unit test generator.
        /// </summary>
        /// <param name="addInHelper">The add in helper.</param>
        /// <returns><see cref="UnitTestGenerator"/> object</returns>
		public override UnitTestGenerator CreateUnitTestGenerator(AddInHelper addInHelper)
		{
			if (addInHelper == null)
			{
			    throw new ApplicationException("You must create and pass _addInHelper");
			}

			VS2005CodeDomHelper codeDomHelper = new VS2005CodeDomHelper();
			return new VS2005UnitTestGenerator(addInHelper, new UnitTestGeneratorHelper(codeDomHelper),
				                               codeDomHelper);
		}

        /// <summary>
        /// Creates the add in helper.
        /// </summary>
        /// <param name="applicationObject">The application object.</param>
        /// <param name="addInInstance">The add in instance.</param>
        /// <returns><see cref="AddInHelper"/> object</returns>
		public override AddInHelper CreateAddInHelper(DTE applicationObject, AddIn addInInstance)
		{
			return new VS2005AddInHelper(applicationObject, addInInstance);
		}
	}
}